package com.zzh.dp;

public class No392_isSubsequence {
    public static void main(String[] args) {
        No392Solution solution = new No392Solution();
        boolean subsequence = solution.isSubsequence("abc", "asdfcsdfc");
        System.out.println(subsequence);
    }
}

class No392Solution {
    public boolean isSubsequence(String s, String t) {
        int sp = 0;
        int tp = 0;
        int sLen = s.length();
        int tLen = t.length();
        while (sp < sLen && tp < tLen) {
            if (s.charAt(sp) == t.charAt(tp)) {
                sp++;
            }
            tp++;
        }

        return sp == sLen;
    }
}
